<!DOCTYPE html>
<html>
  <head>
  	<title>GPin</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
	<meta charset="UTF-8">
	<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
    <style type="text/css" >
	@charset "utf-8";
	html { height: 100% }
	body { height: 100%;font-family: Verdana, Arial, Helvetica, sans-serif; }
	*{margin: 0; padding: 0}
	#map_canvas { height: 100% }
	/* This class is used to style the tooltip */
	.tooltip{
		border:thin 1px #eee;
		background-color:#FFFBF0;
		padding:5px;
		width:200px;
	}
	</style>
<?php
	$settings_file="GP_settings.php";
	if(file_exists($settings_file))
		require($settings_file);
	if (isset($settings))
		$settings=unserialize(stripslashes($settings));
	else 
		$settings=default_settings();
		extract($settings);
    echo '<script src="https://maps.googleapis.com/maps/api/js?key='.$api_key.'&sensor=false" type="text/javascript"></script>
	';
?>
    <script type="text/javascript" src="tooltip.js"></script>
    <script type="text/javascript">
	var places =Array();
	</script>
    <script type="text/javascript" src="places.php"></script>
    <script type="text/javascript">
	function createMap() 
	{
		var mapDiv = document.getElementById("map_canvas");			
		var latlng =new google.maps.LatLng(<?php echo $map_center['latitude'] ?>, <?php echo $map_center['longtitude'] ?>);
		var myOptions = {
			zoom: <?php echo $map_zoom ?>, 
			center:  latlng,
			mapTypeId: google.maps.MapTypeId.<?php echo strtoupper($map_type_id) ?>
			
		};
		var map = new google.maps.Map(mapDiv, myOptions);
		if(places.length)
		{
			for (var key in places)
			{
				var myPlace = places[key];
				if (myPlace.position) 
				{
					var marker = new google.maps.Marker({map: map, position: new google.maps.LatLng(myPlace.position.lat, myPlace.position.lng)});
					createInfoWindow(marker, key);
					createTooltip(marker, key);							
				}
			} 
		}
	}
  </script>
  </head>
  <body onLoad="createMap();">
	<div id="map_canvas"></div>
  </body>
</html>
<?php
// Settings: generating default settings
function default_settings()
{
	$settings['api_key']='';
	$settings['map_center']['latitude']=51.85;
	$settings['map_center']['longtitude']=19.25;
	$settings['map_zoom']=5;
	$settings['map_type_id']="roadmap";
	$settings['limit']=100;
	return $settings;
}
?>